//package com.wjq.demo.feign.ribbon;
//
//import com.netflix.loadbalancer.BaseLoadBalancer;
//import com.netflix.loadbalancer.LoadBalancerBuilder;
//import com.netflix.loadbalancer.Server;
//import com.netflix.loadbalancer.reactive.LoadBalancerCommand;
//import com.netflix.loadbalancer.reactive.ServerOperation;
//import rx.Observable;
//
//import java.io.File;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author wjq
// * @since 2022-12-30
// */
//public class RibbonTest {
//
//    public static void main(String[] args) {
//        List<Server> serverList = new ArrayList<>();
//        serverList.add(new Server("www.coredy1.com", 1));
//        serverList.add(new Server("www.coredy2.com", 2));
//        serverList.add(new Server("www.coredy3.com", 3));
//        BaseLoadBalancer loadBalancer = LoadBalancerBuilder.newBuilder().buildFixedServerListLoadBalancer(serverList);
//        for (int i = 0; i < 6; i++) {
//            LoadBalancerCommand<String> balancerCommand = LoadBalancerCommand.<String>builder()
//                    .withLoadBalancer(loadBalancer).build();
//            ServerOperation<String> operation = server -> Observable.create(t -> {
//                t.onNext(server.getHost());
//                t.onCompleted();
//            });
//            String single = balancerCommand.submit(operation).toBlocking().single();
//            System.out.println(single);
//        }
//
//    }
//
//}
